﻿<?php
require_once('../../config.php');
global $DB;

/* Ket noi den file javascript - module.js */
$PAGE->requires->js_init_call('M.local_myplugin');	
	
/* Chuan bi trang web can hien thi */	
$url = new moodle_url($CFG->wwwroot.'local/myplugin/cdiosubject.php');
$PAGE->set_url($url);
$PAGE->set_title('My plugin page title');
$PAGE->set_heading('My plugin page heading');
$PAGE->set_pagelayout('standard');

//Them thanh menu ngang ung voi trang trong duong link
navigation_node::override_active_url(new moodle_url($CFG->wwwroot.'/local/myplugin/cdiosubject.php', array('param'=>'value')));
echo $OUTPUT->header();

//Get list of majors
$rs =$DB->get_records('major');

//Display list of majors into combobox
echo html_writer::start_tag('form');
echo html_writer::start_tag('select', array('id'=> 'subject', 'onchange'=>'showSubject(this.options[this.selectedIndex].value)'));
echo html_writer::tag('option', 'Chọn ngành đào tạo', array('selected' =>'true'));
foreach($rs as $record) {
	echo html_writer::tag('option', $record->major_name);
}
echo html_writer::end_tag('select');
echo html_writer::end_tag('form');
echo html_writer::tag('div', '', array('id'=>'txtHint'));
/*
$rs = $DB->get_records('subject');

echo html_writer::start_tag('table',array('border'=>'1'));
echo html_writer::tag('th', 'ID');
echo html_writer::tag('th', 'Eng Name');
echo html_writer::tag('th', 'Vi Name');
echo html_writer::tag('th', 'Credit');
echo html_writer::tag('th', 'LT');
echo html_writer::tag('th', 'TH');

  foreach ($rs as $r) {
	echo html_writer::start_tag('tr', array('border'=>'2'));
	echo html_writer::tag('td', $r->subject_id);
	echo html_writer::tag('td', $r->subject_name_en);
	echo html_writer::tag('td', $r->subject_name_vn);
	echo html_writer::tag('td', $r->subject_credit);
	echo html_writer::tag('td', $r->subject_theory_hr);
	echo html_writer::tag('td', $r->subject_practice_hr);
	echo html_writer::end_tag('tr');
  }
echo html_writer::end_tag('table');
*/
//$rs->close(); // Don't forget to close the recordset!


echo $OUTPUT->footer();
?>